package com.douqu.game.core.config.challenge;

import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.factory.DataFactory;
import com.douqu.game.core.factory.LoadFactory;
import com.douqu.game.core.util.LoadUtils;
import com.douqu.game.core.util.LogUtils;

import java.util.Arrays;

/**
 * @author wangzhenfei
 *         2017-11-28 15:28
 *         战斗初始化配置
 */
public class WorldBossParameterConfig extends GameObject{

    /**
     *  怪物等级
     *   1.等级
         2.星级
         3.装备强化等级
         4.装备进阶等级
         5.法宝强化等级
         6.法宝升阶等级
     填为0代表不计算该部分属性
     * */
    public int[] monsterLv;

    /**战斗力**/
    public int fc;

    /**
     * 伤害转化率*
     */
    public int translateRate;

    @Override
    public boolean check()
    {
        if(monsterLv == null)
        {
            LogUtils.error(getClass().getSimpleName() + " Load BattleInitConfig monsterLv is null! id:" + id);
            return false;
        }
        if(monsterLv.length != 14)
        {
            LogUtils.error(getClass().getSimpleName() + " Load BattleInitConfig monsterLv Error -> id:" + id);
            return false;
        }

        if (translateRate <= 0) {
            LogUtils.error("WorldBossConfig check translateRate is error -> id:" + id + " name:" + name);
            return false;
        }
        return true;
    }


    @Override
    public boolean setVariable(String key, String value)
    {
      if("monsterLv".equals(key))
        {
            monsterLv = LoadUtils.loadIntArray(key, value);
            return true;
        }

        else
            return super.setVariable(key, value);
    }


}
